#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QStandardItemModel>
#include <QProgressDialog>
#include <QDate>
#include "databasehelper.h"
#include "employee.h"
#include "addexpenddialog.h"
#include "newexpensedialog.h"
namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT
public:
    Databasehelper *database;

    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    NewExpenseDialog *getMNewExpDlg() const;
    void setMNewExpDlg(NewExpenseDialog *value);

    AddExpendDialog *getMAddExpDlg() const;
    void setMAddExpDlg(AddExpendDialog *value);

public slots:
    //    void calendarButtonClicked();

    //Salary Rate Slider
    void salaryRateSliderValueChanged (int value);

    //Cash Rate Slider
    void cashRateSliderValueChanged (int value);

//    //Reset to default field Employee management
    void resetEmployeeFieldButtonClicked();

    // Update or insert Employee to database
    void pushButtonUpdateEmployeeCliked();

//    //Load Employee list to table view
//    void pushButtonLoadEmployee();

//    //Upcase first character in name String
//    void lineEditEmployeeNameTextChanged(QString text);

//    //get selected row in Employee table view
    void tableViewEmployeeListClicked(const QModelIndex &index);

    //get changed from Income EditDate
    void dateEditIncomeChanged(QDate);

    //click to update income Employee
    void pushButtonUpdateEmployeeIncomeClicked();

    //get changed from Income EditDate
    void dateEditSalonIncomeChanged(QDate);

    //click to update income salon
    void pushButtonUpdateSalonIncomeClicked();

    //get changed event in salon income table view
    void itemModelSalonIncomeDataChanged(QModelIndex,QModelIndex);

    //get changed event in salon income table view
    void itemModelEmployeeIncomeDataChanged(QModelIndex,QModelIndex);

    //get changed from Income EditDate
    void dateEditPayRollChanged(QDate);

    //update salary extend
    void pushButtonUpdatePayrollClicked();

//    // test genaration PDF function
//    void pushButtonTestPDFClicked();

//    //update expend menu
//    void pushButtonUpdateExpendMenuManClicked();

//    //update giftcard
//    void pushButtonUpdateGiftCard();

//    // changed text in line edit gift card search
//    void lineEditGiftcardSearchChanged(QString);

//    // update expend_others
//    void pushButtonUpdateExpendOthersClicked();

//    // search Expend others
//    void pushButtonSearchExpendOthersClicked();

//    //get changed from expned others EditDate
//    void dateEditExpendOthersChanged(QDate);
private slots:
    void on_pushButtonOtherExpenses_clicked();

private:
    Ui::MainWindow *ui;
    QStandardItemModel *mItemModelEmployee;
    QStandardItemModel *mItemModelEmployeeIncome;
    QStandardItemModel *mItemModelSalonIncome;
    QStandardItemModel *mItemModelPayroll;
    QStandardItemModel *mItemModelGiftCards;
    QStandardItemModel *mItemModelGiftCardsList;
    QStandardItemModel *mItemModelExpendMenuMan;
    QStandardItemModel *mItemModelExpendOthers;
    QStandardItemModel *mItemModelExpendOthersMan;
    AddExpendDialog *mAddExpDlg;


    void Initialize();
    void clearEmployeeField();
    void loadEmployeeList();
    void loadEmployeeIncome(QDate date);
    void loadSalonIncome(QDate);
    void loadpayroll(QDate);
    void loadExpend(QDate from, QDate to);
    void loadGiftCard(int mode);
    void loadGiftCard(int mode, QString query);
    void loadExpendMenuMan();
    void loadExpendOthers(QDate date);
    void loadExpendOthersMan(QDate from, QDate to);

    QProgressDialog* mProgressDialog;


};

#endif // MAINWINDOW_H
